//package nancal.mp.model
//
//import nancal.mp.db.mongo.JenkinsLanguageEnum
//import nancal.mp.db.mongo.entity.dev.AppDeploySetting
//import nancal.mp.db.mongo.entity.dev.JenkinsBuildDetailInfo
//import nancal.mp.db.mongo.entity.dev.JenkinsBuildInfo
//import nancal.mp.db.mongo.entity.dev.JenkinsLog
//import nancal.mp.db.mongo.extend.getAppDeploySetting
//import nancal.mp.db.mongo.mor
//import nbcp.base.db.IdCodeName
//import nbcp.base.extend.Slice
//import nbcp.base.extend.must
//import nbcp.myoql.db.mongo.queryById
//
///**
// * Dockerfile 里的变量
// */
//class DockerfileDataModel(var targetEnv: String = "") {
//    var productLine: IdCodeName = IdCodeName()
//    var buildInfo: JenkinsBuildInfo = JenkinsBuildInfo()
//    var language: JenkinsLanguageEnum? = null
//    var languageVersion: String = ""
//    var namespace: String = ""
//    var buildVersion: JenkinsBuildDetailInfo = JenkinsBuildDetailInfo()
//
//    val dockerName: String
//        get() = buildInfo.serviceName
//
//    val appDeploySetting: AppDeploySetting
//        get() {
//            return mor.dev.appDeploySetting.getAppDeploySetting(targetEnv)
//        }
//
//    val harborHost: String
//        get() {
//            return appDeploySetting.harborServer.host
//        }
//
//    val javaOpts: String
//        get() {
//            return appDeploySetting.javaOpts
//        }
//
//    val javaArgs: String
//        get() {
//            return appDeploySetting.javaArgs
//        }
//
//    /**
//     * 运行镜像
//     */
//    val dockerImage: String
//        get() {
//            return   appDeploySetting.getRunImageFullName(this.language!!, this.languageVersion)
//        }
//
//
//    /**
//     * 构建镜像
//     */
//    val dockerBuildImage: String
//        get() {
//            return appDeploySetting.getBuildImageFullName(this.language!!, this.languageVersion)
//        }
//
//    val folder: String
//        get() {
//            var ret = this.buildInfo.buildFolder
//            if (ret.startsWith("/")) {
//                ret = ret.Slice(1);
//            }
//
//            if (ret.endsWith("/")) {
//                ret = ret.Slice(0, -1)
//            }
//
//            if (ret.isEmpty()) {
//                ret = "."
//            }
//            return ret;
//        }
//
//    companion object {
//        fun load(jenkinsLog: JenkinsLog): DockerfileDataModel {
//            var productLine =
//                mor.dev.productLine.queryById(jenkinsLog.productLine.id).toEntity().must()
//                    .elseThrow { "找不到 productLine: " + jenkinsLog.productLine.id }
//
//            var def = DockerfileDataModel(jenkinsLog.buildInfo.targetEnv);
//            def.language = jenkinsLog.language;
//            def.languageVersion = jenkinsLog.languageVersion;
//            def.productLine = jenkinsLog.productLine;
//            def.buildInfo = jenkinsLog.buildInfo;
//            def.buildVersion = jenkinsLog.buildVersion
//            def.namespace = productLine.clusterCode
//
////            def.dockerImageName = jenkinsLog.currentGitFolder.config.dockerImageName
////            def.dockerImageVersion = jenkinsLog.currentGitFolder.config.dockerImageVersion
////
////            def.dockerBuildImageName = jenkinsLog.currentGitFolder.config.dockerBuildImageName
////            def.dockerBuildImageVersion = jenkinsLog.currentGitFolder.config.dockerBuildImageVersioin
////
////
////            if (def.dockerImageName.isEmpty()) {
////                def.dockerImageName = dockerImageData.dockerImage
////            }
////
////            if (def.dockerBuildImageName.isEmpty()) {
////                def.dockerBuildImageName = dockerImageData.dockerBuildImage
////            }
//            return def;
//        }
//    }
//}
